package com.lws.basic.utils.common;

import android.support.annotation.DrawableRes;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;



public class GlideUtils {
    /**
     * @return 生成将图片圆形裁剪的修图器，
     * 执行{@link com.bumptech.glide.RequestBuilder#apply(RequestOptions)}令Glide加载圆形图片
     */
    public static RequestOptions circleCrop() {
        RequestOptions options = new RequestOptions()
                .circleCrop()
                .diskCacheStrategy(DiskCacheStrategy.ALL);
        return options;
    }

    /**
     * @param options
     * @param resourceId 占位符
     * @return
     */
    public static RequestOptions placeHolder(RequestOptions options, @DrawableRes int resourceId) {
        if (options == null) options = new RequestOptions();
        options.placeholder(resourceId);
        return options;
    }

}
